﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sharp.Domain.Repositories;

namespace Sharp.Domain.PlatformBoundedContext.PersonModule.Aggregates
{
    public partial class EmployeeRepository
    {
        public int CountEmployees(Guid orgId)
        {
            var currentHeadcount = (this.Context as ISql).ExecuteQuery<int>("SELECT COUNT(*) FROM Platform_People P INNER JOIN Platform_Employees E ON P.Id = E.Id WHERE OrgId = {0} AND PostStateCode <> {1}", orgId, "02").First();
            // <>02 不等于已离职
            return currentHeadcount;
        }
    }
}
